<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data">
	<input type="hidden" name="nebula_req_param_querypk">
	<c:forEach items="${requestScope.nebula_model_editview_properties}" var="property">
	<c:choose>
	<%-- Hidden --%>
	<c:when test="${property.type == 'hidden'}">
	<input type="hidden" name="${property.name}" value="${property.defaultValue}">
	</c:when>
	<c:otherwise>
	<div class="form-group">
		<label class="col-lg-12 control-label">${property.label}：</label>
		<div class="col-lg-12 <c:if test="${property.type == 'treeselect'}">input-group treeselect</c:if> ">
			
			<%-- Validate String --%>
			<c:set var="nebula_model_data_rules" value=""/>
			<c:forEach items="${property.validates}" var="validate">
				<c:set var="nebula_model_data_rules" value="${nebula_model_data_rules} data-rule-${validate.type}='true' data-msg-${validate.type}='${validate.message }'"></c:set>
			</c:forEach>
			
			<c:choose>
			<%-- Text --%>
			<c:when test="${property.type == 'text'}">
			<input  placeholder="${property.placeholder}" ${nebula_model_data_rules} type="text" name="${property.name}" class="form-control" ${property.disabled} ${property.readonly} value="${property.defaultValue}">
			</c:when>
			
			<%-- Radio --%>
			<c:when test="${property.type == 'radio'}">
			<c:forEach items="${property.radio.items}" var="item">
				<label class="checkbox-inline">
					<input <c:if test="${property.radio.defaultValue == item.value}">checked</c:if> type="radio" name="${property.name}" value="${item.value}"> ${item.label}
				</label>
			</c:forEach>
			</c:when>
			
			<%-- Textarea --%>
			<c:when test="${property.type == 'textarea'}">
			<textarea ${nebula_model_data_rules} rows="3" name="${property.name}" cols="" class="form-control" ${property.disabled} ${property.readonly} >${property.defaultValue}</textarea>
			</c:when>
			
			<%-- Password --%>
			<c:when test="${property.type == 'password'}">
			<input ${nebula_model_data_rules} type="password" name="${property.name}" class="form-control" ${property.disabled} ${property.readonly} value="${property.defaultValue}">
			</c:when>
			
			<%-- TreeSelect --%>
			<c:when test="${property.type == 'treeselect'}">
			<div class="input-group-btn">
				<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
				<div id="${property.tree.id}" class="dropdown-menu"></div>
			</div>
			<input type="text" class="form-control" readonly="readonly"/>
			<input treeid="${property.tree.id}" type="hidden" name="${property.name}" />
			<script type="text/javascript">
			nebula.trees.push({
				"type":"${property.type}","divid":"${property.tree.id}", "treeId":"${property.tree.treeId}", "parent":"${property.tree.treePid}", "text":"${property.tree.treeName}", "dataset":"${property.tree.dataset}", "opened":"${property.tree.opened}"
			});
			</script>
			</c:when>
			
			<%-- Select --%>
			<c:when test="${property.type == 'select'}">
			<script type="text/javascript">
			nebula.selects.push({
				"id":"${property.select.id}", "label":"${property.select.label}", "value":"${property.select.value}","dataset":"${property.select.dataset}"
			});
			</script>
			<select ${nebula_model_data_rules} ${property.select.multiple} id="${property.select.id}" name="${property.name}" class="form-control" ${property.disabled} ${property.readonly}></select>
			</c:when>
			
			<%-- AutoComplete --%>
			<c:when test="${property.type == 'autocomplete'}">
			<script type="text/javascript">
			nebula.completes.push({
				"id":"${property.autoComplete.id}", "name":"${property.autoComplete.name}","dataset":"${property.autoComplete.dataset}"
			});
			</script>
			<input ${nebula_model_data_rules} id="${property.autoComplete.id}" name="${property.name}" type="text" class="form-control"  ${property.disabled} ${property.readonly}>
			</c:when> 
			
			<%-- File --%>
			<c:when test="${property.type == 'file'}">
			<input ${nebula_model_data_rules} type="file" name="${property.name}" class="form-control" ${property.disabled} ${property.readonly} value="${property.defaultValue}">
			</c:when>
			
			<%-- Date Picker --%>
			<c:when test="${property.type =='date'}">
            <div class="input-group date form-date" data-date="" data-date-format="yyyy-mm-dd" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
             <input ${nebula_model_data_rules} name="${property.name}" class="form-control" size="16" type="text" value="${property.defaultValue}" readonly>
             <span class="input-group-addon btn-danger form-date-remove"><span class="glyphicon glyphicon-remove icon-remove"></span></span>
			 <span class="input-group-addon btn-warning"><span class="glyphicon glyphicon-calendar icon-calendar"></span></span>
            </div>
			</c:when>
			
			<%-- Month Picker --%>
			<c:when test="${property.type =='date-month'}">
            <div class="input-group date form-date-month" data-date="" data-date-format="yyyy-mm" data-link-field="dtp_input2" data-link-format="yyyy-mm">
             <input ${nebula_model_data_rules} name="${property.name}" class="form-control" size="16" type="text" value="${property.defaultValue}" readonly>
             <span class="input-group-addon btn-danger form-date-remove"><span class="glyphicon glyphicon-remove icon-remove"></span></span>
			 <span class="input-group-addon btn-warning"><span class="glyphicon glyphicon-calendar icon-calendar"></span></span>
            </div>
			</c:when>
			
			
			<%-- Other --%>
			<c:otherwise>
				
			</c:otherwise>
			</c:choose>
		</div>
	</div>
	</c:otherwise>
	</c:choose>
	</c:forEach>
	<div class="form-group" style="margin-bottom: 0;">
		<div class="col-lg-12">
			<button type="submit" data-loading-text='请稍候...' class="btn btn-danger">保存</button>
		</div>
	</div>
</form>